package consts


type ResponseType string

const (
	Code  ResponseType = "code"
	Token ResponseType = "token"
)
// 验证请求类型
func CheckResponseType(rt ResponseType) bool {
	if rt==Code||rt==Token {
		return true
	}
	return false
}
func (rt ResponseType) String() string {
	if rt == Code ||
		rt == Token {
		return string(rt)
	}
	return ""
}

// GrantType authorization model
type GrantType string
// define authorization model
const (
	AuthorizationCode   GrantType = "authorization_code"
	PasswordCredentials GrantType = "password"
	ClientCredentials   GrantType = "client_credentials"
	Refreshing          GrantType = "refresh_token"
	Implicit            GrantType = "__implicit"
)
//验证token 请求类型
func CheckGrantType(gt GrantType) bool {
	if gt==AuthorizationCode||gt==PasswordCredentials ||
		gt==ClientCredentials||gt==Refreshing{
		return true
	}
	return false
}
func (gt GrantType) String() string {
	if gt == AuthorizationCode ||
		gt == PasswordCredentials ||
		gt == ClientCredentials ||
		gt == Refreshing {
		return string(gt)
	}
	return ""
}